// components/CustomComment/CustomComment.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {

    },

    /**
     * 组件的初始数据
     */
    data: {
		count:8,			// 评论数量
		inputBottom:0,
		inputText:'',
		// 每条评论详情
		infos:[{
			image:"../../images/temp.png",
			name:"我是小仙女",
			comment:"我陪你走过的路你不能忘。",
			time:"刚刚",
			like:10
		},{
			image:"../../images/temp.png",
			name:"你是小仙女",
			comment:"飞蛾对灯火说的话 \n我想对你再说一次 \n奋不顾身之前，我是知道结局的。",
			time:"20分钟前",
			like:10
		},{
			image:"../../images/temp.png",
			name:"他是小仙女",
			comment:"我知道你不喜欢我， \n我猜你也不会喜欢我，\n但是，我喜欢你，与你无关。。",
			time:"20:14",
			like:10
		},{
			image:"../../images/temp.png",
			name:"她是小仙女",
			comment:"我陪你走过的路你不能忘。",
			time:"5:24",
			like:10
		},{
			image:"../../images/temp.png",
			name:"谁是小仙女",
			comment:"你的一生我只借一程、\n这一程便是余生。",
			time:"2021/4/20 18:12",
			like:10
		},{
			image:"../../images/temp.png",
			name:"都是小仙女",
			comment:"记住我的名字和我带给你的故事。",
			time:"2021/4/20 18:12",
			like:10
		},{
			image:"../../images/temp.png",
			name:"全是小仙女",
			comment:"我只是个普通人，渴了会喝水、\n困了会想睡、痛了 大概也会放手吧。。",
			time:"2021/4/20 18:12",
			like:10
		},{
			image:"../../images/temp.png",
			name:"最爱小仙女",
			comment:"我耗尽力气和真心最后也只感动了我自己。",
			time:"2021/4/20 18:12",
			like:10
		}],
    },

    /**
     * 组件的方法列表
     */

    methods: {
		shut:function(){
			this.triggerEvent("Close")
		},
		
		//输入聚焦
		foucus: function (e) {
			let that = this;
			that.setData({
				inputBottom: e.detail.height,
			})
		},
		 
		 
		//失去聚焦
		blur: function (e) {
			var that = this;
			that.setData({
				inputBottom: 0,
			})
		},
		
		// 键盘输入值触发
		getInputText: function(e) {
			let that = this
			console.log(e)
			that.setData({
				inputText: e.detail.value,
			})
		},
		
		//用户输入内容--提交输入
		submit:function(e){
			var that = this;
			console.log(e)
			console.info(that.data.inputText);
			if (!that.data.inputText){
				wx.showToast({
					icon:'none',
					title:'请输入内容'
				})
				return false;
			}
		 
			// talkList.push({
			// 	who: 2,
			// 	text: that.data.inputText
			// })
		 
			that.setData({
				// talkList: talkList,
				inputText:'',
				//inputBottom: 0
			})
		 
			// that.scrollToBottom();
		},
    }
})
